package lu.med.praxiswahl.wahlumed.client.menustructure;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JOptionPane;

import lu.med.praxiswahl.wahlumed.client.wclient.Main;

public class MenuListenerMainExitActionListener implements ActionListener {
	private Main dataManager;

	public MenuListenerMainExitActionListener(Main dataManager) {
		this.dataManager = dataManager;
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		if (JOptionPane.showConfirmDialog(dataManager,
				"Wollen Sie wirklich die Anwendung beenden?",
				"Anwendung Beenden", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {

			dataManager.getAccountContext().logOutUser(Main.loggedUser);
			System.exit(0);
		}
	}
}
